import 'package:flutter/material.dart';

class BottomNavigationBarDemo extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _BuildStatefulState();
  }

}

class _BuildStatefulState  extends State<BottomNavigationBarDemo>{
  int _currentIndex = 0;
  void _onTabHandler(int index ){

    setState(() {
      _currentIndex = index;
    });

  }
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return BottomNavigationBar(
      fixedColor: Colors.black,
      type: BottomNavigationBarType.fixed,
      currentIndex: _currentIndex,
      onTap: _onTabHandler,
      items:[
        BottomNavigationBarItem(icon: Icon(Icons.home),title: Text("Home")),
        BottomNavigationBarItem(icon: Icon(Icons.history),title: Text("History")),
        BottomNavigationBarItem(icon: Icon(Icons.message),title: Text("Message")),
        BottomNavigationBarItem(icon: Icon(Icons.person),title: Text("Person")),
      ]
      ,);
  }
}